<template>
  <div class="app-container">
    <MmvTitle title="违章押金付款情况"></MmvTitle>
    <el-descriptions class="margin-top" :column="1" border>
      <el-descriptions-item label-class-name="my-descriptions-label"  label="应付违章押金" :labelStyle="{width:'200px'}">{{detail.depositPayable||0}}元</el-descriptions-item>
      <el-descriptions-item label-class-name="my-descriptions-label"  label="预授权已付" :labelStyle="{width:'200px'}">{{detail.preLicensingAmount||0}}元</el-descriptions-item>
      <el-descriptions-item label-class-name="my-descriptions-label"  label="其他方式已付" :labelStyle="{width:'200px'}">{{detail.otherAmount||0}}元</el-descriptions-item>
      <el-descriptions-item label-class-name="my-descriptions-label"  label="违章费用抵扣" :labelStyle="{width:'200px'}">{{detail.vehicleDamageExpense||'0元'}}</el-descriptions-item>
      <el-descriptions-item label-class-name="my-descriptions-label"  label="违章押金结余" :labelStyle="{width:'200px'}">{{detail.surplus||'0元'}}</el-descriptions-item>
    </el-descriptions>

    <el-row  class="app-container" v-if="detail.surplus">
      {{detail.surplus||0}}，将由财务人员进行退款
    </el-row>

    <div class="dialog-footer" style="text-align: end;">
      <el-button @click="DoDepositSettlement" type="primary">完成结算</el-button>
      <el-button @click="close()">关闭</el-button>
    </div>
  </div>
</template>

<script>
import {
  illegalDetail,
  IllegalDepositRefund
} from '@/api/order/index';
  import MmvTitle from '@/components/MmvUI/MmvTitle.vue';
  export default {
    components: {
      MmvTitle
    },
    props: ['orderNo'],

    data() {
      return {
        detail: {},
        loading: true,
        submitBtnLoading: false

      }
    },
    mounted() {
      this.doDepositRefundDetail();
    },
    methods: {
      close() {
        this.$emit('close');
      },
      DoDepositSettlement() {
        this.submitBtnLoading=true
        IllegalDepositRefund(this.orderNo).then(response => {
          this.$message.success(response.msg);
          this.close();
        }).finally(err=>{
          this.submitBtnLoading=false
        });
      },
      doDepositRefundDetail() {
        illegalDetail(this.orderNo).then(response => {
          this.detail = response.data || {};
          this.loading = false
        });
      },
    },

  }
</script>

<style scoped="scoped">
  .mmv-title {
   margin: 0 !important;
   border-bottom: none !important;
  }
  .el-form-item {
      margin-bottom: 5px !important;
  }

  .el-table--medium .el-table__cell {
      padding: 3px !important;
  }

  .footer{
        text-align: end;
        padding-top: 20px;
  }
</style>
